using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DigitalTrainSuite
{
	public partial class FormMainMenu : Form
	{
		private FormController formController;
		private FormDesigner formDesigner;
		private DataSetLayout data;

        //private Int32 argbColor = ;
        private Color argbColor = Color.FromArgb(191, 207, 255);
        private Color buttonBoarder = Color.FromArgb(18, 18, 125);

		public FormMainMenu()
		{
			InitializeComponent();
			formController = null;
			formDesigner = null;
			this.data = new DataSetLayout();
			this.data.ReadXml(Properties.Settings.Default.LayoutFilePath);

            //
            //this.buttonDesigner.BackColor = Color.FromArgb(0,204,0);
            //this.buttonController.FlatAppearance.BorderColor = buttonBoarder;
            //this.buttonController.FlatAppearance.BorderSize = 20;
            //this.buttonController.FlatAppearance.MouseOverBackColor = argbColor;
            
            //this.buttonController.FlatStyle = FlatStyle.Popup;

           // this.buttonController.BackColor = Properties.Settings.Default.FormBackColor;
           // this.buttonController.UseVisualStyleBackColor = true;
           
		}

		private void buttonController_Click(object sender, EventArgs e)
		{
			if (this.formController == null || this.formController.IsDisposed)
			{
				this.formController = new FormController(data);
				this.formController.buttonControllerClick += new EventHandler(this.buttonController_Click);
				this.formController.buttonDesignerClick += new EventHandler(this.buttonDesigner_Click);
			}
			this.formController.Show();
			this.formController.Focus();
		}

		private void buttonClose_Click(object sender, EventArgs e)
		{
			if (this.formController != null && this.formController.IsDisposed)
			{
				this.formController.Close();
				this.formController.Dispose();
			}
			if (this.formDesigner != null && this.formDesigner.IsDisposed)
			{
				this.formDesigner.Close();
				this.formDesigner.Dispose();
			}
			/*if (this.formLayoutManager.IsDisposed)
			{
				this.formLayoutManager.Close();
				this.formLayoutManager.Dispose();
			}*/
			this.Close();
		}

		private void buttonDesigner_Click(object sender, EventArgs e)
		{
			if (this.formDesigner == null || this.formDesigner.IsDisposed)
			{
				this.formDesigner = new FormDesigner(data);
				this.formDesigner.buttonControllerClick += new EventHandler(this.buttonController_Click);
				this.formDesigner.buttonDesignerClick += new EventHandler(this.buttonDesigner_Click);
			}
			this.formDesigner.Show();
			this.formDesigner.Focus();
		}
	}
}